package com.wang.webSocket;

import io.netty.channel.ChannelHandlerAdapter;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.http.websocketx.TextWebSocketFrame;

public class WebOutBoundHander extends ChannelHandlerAdapter {

    public static void outData(ChannelHandlerContext ctx, String msg) {

        try {
            TextWebSocketFrame tws = new TextWebSocketFrame(msg);
            ctx.channel().writeAndFlush(tws);

            System.out.println("发送成功");
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

}
